import {routers} from "@/router";
import { setSessionStorage, getSessionStorage, removeSessionStorage} from '@/utils/storage'

const system = {
    state: {
        sidebar: true,
        visitedViews: []
    },
    mutations: {
        TOGGLE_SIDEBAR: state => {
            state.sidebar = !state.sidebar
        }
    },
    actions: {
        ToggleSideBar({ commit, state }) {
            commit('TOGGLE_SIDEBAR')
            setSessionStorage('sidebar', state.sidebar)
        },
        SetSidebar({ commit, state }, sidebar) {
            state.sidebar = (sidebar === 'false' || sidebar === false ? false : true)
        }
    }
}

export default system
